using System.ComponentModel.DataAnnotations;
using FytSoa.Common.Enum;
using FytSoa.Domain.Hr;
using SqlSugar;

namespace FytSoa.Domain.Erp;

/// <summary>
/// erp-采购申请单
/// </summary>
[SugarTable("erp_purchase_apply")]
public class ErpPurchaseApply:Entity
{
    /// <summary>
    /// 申请编号
    /// </summary>
    [Required]
    [StringLength(50)]
    public string Number { get; set; }

    /// <summary>
    /// 订单编号
    /// </summary>
    [Required]
    public long OrderId { get; set; }
    
    /// <summary>
    /// 订单
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(OrderId))]
    public ErpProduceOrder Order { get; set; }

    /// <summary>
    /// 申请人
    /// </summary>
    [Required]
    public long ApplyPersonId { get; set; }
    
    /// <summary>
    /// 申请人
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(ApplyPersonId))]
    public HrEmployee Employee { get; set; }

    /// <summary>
    /// 申请状态
    /// </summary>
    [Required]
    public ErpProduceApplyEnum Status { get; set; } = 0;

    /// <summary>
    /// 是否加急
    /// </summary>
    [Required]
    public bool IsUrgent { get; set; } = false;

    /// <summary>
    /// 备注信息
    /// </summary>
    public string Remark { get; set; }

    /// <summary>
    /// 创建人
    /// </summary>
    public string CreateUser { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [Required]
    public DateTime CreateTime { get; set; } = DateTime.Now;

    /// <summary>
    /// 更新人
    /// </summary>
    public string UpdateUser { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime? UpdateTime { get; set; }


}